package com.parkinglot.service.Impl;

import cn.hutool.core.date.DateTime;
import com.parkinglot.core.Result;
import com.parkinglot.dao.MonthbilRecordDao;
import com.parkinglot.dao.OrderDao;
import com.parkinglot.dao.UserCarDao;
import com.parkinglot.dao.UserDao;
import com.parkinglot.enumeration.DateTypeEnum;
import com.parkinglot.extend.orderextend.OrderExtend;
import com.parkinglot.parmeter.OrderPayParm;
import com.parkinglot.parmeter.OrderqueryParm;
import com.parkinglot.pojo.GarageMonthConfig;
import com.parkinglot.pojo.Order;
import com.parkinglot.pojo.User;
import com.parkinglot.pojo.UserCar;
import com.parkinglot.service.GarageMonthConfigService;
import com.parkinglot.service.GarageService;
import com.parkinglot.service.OrderService;
import com.parkinglot.util.CheckCarnumberUtil;
import com.parkinglot.util.DateUtils;
import com.parkinglot.util.DatesUtil;
import com.parkinglot.util.RandomsUtil;
import com.parkinglot.vo.*;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.temporal.TemporalAdjusters;
import java.util.*;

/**
 * (Order)表服务实现类
 *
 * @author makejava
 * @since 2020-11-13 15:29:39
 */
@Service("orderService")
public class OrderServiceImpl implements OrderService {
    @Resource
    private OrderDao orderDao;
    @Resource
    private UserDao userDao;
    @Resource
    private GarageService garageService;
    @Resource
    private CheckCarnumberUtil checkCarnumberUtil;
    @Resource
    private MonthbilRecordDao monthbilRecordDao;
    @Resource
    private GarageMonthConfigService garageMonthConfigService;
    @Resource
    private UserCarDao userCarDao;


    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public Order queryById(Integer id) {
        return this.orderDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<Order> queryAllByLimit(int offset, int limit) {
        return this.orderDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     * qrtype :0入场 1出场
     *
     * @param order 实例对象
     * @return 实例对象
     */
  /*  @Override
    public OrderqueryVo insert(Order order) {
        int code = 0;
        UserVo userVo = null;
        OrderqueryVo order1 = null;
        OrderqueryVo orderupdate = null;
        Order order2 = null;
        OrderqueryVo order3 = null;
        OrderqueryVo orderqueryVo = new OrderqueryVo();
        UsercarMonthVipVo usercarMonthVipVo=null;
        UsercarMonthVipParm usercarMonthVipParm=new UsercarMonthVipParm();
        try {
            //查询订单 如果订单表不存在此用户 说明是第一次进入停车场 返回null
            order1 = orderDao.queryBycarnumber(order);
            BeanUtils.copyProperties(order,usercarMonthVipParm);
            usercarMonthVipVo=monthbilRecordDao.queryexistencevip(usercarMonthVipParm);//查询用户是否是会员
            if (order1 == null && order.getQrtype().equals("0")) { //判断 如果没车牌号进入
                //第一次进入停车场  插入数据
                order.setOrdernumber(String.valueOf(RandomsUtil.buildRandom()));
                code = orderDao.insert(order);
                if (code > 0) {
                    order2 = orderDao.queryById(order.getId());
                    SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    order2.setParkingTimesjc(sf.parse(order2.getParkingTime()).getTime());
                    BeanUtils.copyProperties(order2, orderqueryVo);
                    userVo = userDao.queryById(order.getUserid());
                    orderqueryVo.setVipstatus(Integer.parseInt(userVo.getVipstatus().toString()));
                }
            }
            else if(order1 != null && order.getQrtype().equals("1")) {//qrtyep 0入场 1出场
                if (usercarMonthVipVo != null) {
                    if (usercarMonthVipVo.getVipstatus() == 1) { //如果是月票用户 直接通过
                        orderqueryVo.setVipstatus(usercarMonthVipVo.getVipstatus());
                    } else { //不是会员
                        order.setParkingCktime(DateUtils.getFormatDate(new Date()));//车辆出场时间
                        code = orderDao.update(order);
                        String newdate = DateUtils.dateadd(usercarMonthVipVo.getMonthEndtime(), 1);//月票的结束时间加上1天
                        int hours = DateUtils.sjc(order.getParkingCktime(), newdate);
                        GaragequeryVo garagequeryVo = garageService.queryBygaragecode(order.getGarageid());//查询停车场收费标准
                        if (hours < 60) {
                          *//*  BigDecimal money= garagequeryVo.getBanhour();
                            BigDecimal hour=BigDecimal.valueOf(hours);*//*
                            // BigDecimal total= money.multiply(hour);
                            order.setPayMoney(garagequeryVo.getBanhour());
                            orderDao.update(order);
                            orderqueryVo.setPayMoney(garagequeryVo.getBanhour());
                            orderqueryVo.setParkingCktime(order.getParkingCktime());
                        } else if (hours > 60) {
                            BigDecimal money = garagequeryVo.getOnehour();
                            BigDecimal hour = BigDecimal.valueOf(hours);
                            BigDecimal total = money.multiply(hour);
                            order.setPayMoney(total);
                            orderDao.update(order);
                            orderqueryVo.setPayMoney(total);
                            orderqueryVo.setParkingCktime(order.getParkingCktime());
                        }
                    }
                } else{
                    //出场处理  订单金额结算
                    order.setParkingCktime(DateUtils.getFormatDate(new Date()));//车辆出场时间
                code = orderDao.update(order);
                String firsttime = order1.getParkingTime();
                if (code > 0) {
                    order3 = orderDao.queryBycarnumber(order);
                    String endtime = order3.getParkingCktime();
                    int hours = DateUtils.sjc(firsttime, endtime);
                    GaragequeryVo garagequeryVo = garageService.queryBygaragecode(order.getGarageid());//查询停车场收费标准
                    if (hours < 60) {
                        BigDecimal money = garagequeryVo.getBanhour();
                        BigDecimal hour = BigDecimal.valueOf(hours);
                        // BigDecimal total= money.multiply(hour);
                        order.setPayMoney(garagequeryVo.getBanhour());
                        orderDao.update(order);
                        orderqueryVo.setPayMoney(garagequeryVo.getBanhour());
                        orderqueryVo.setParkingCktime(order.getParkingCktime());
                    } else if (hours > 60) {
                        BigDecimal money = garagequeryVo.getOnehour();
                        BigDecimal hour = BigDecimal.valueOf(hours);
                        BigDecimal total = money.multiply(hour);
                        order.setPayMoney(total);
                        orderDao.update(order);
                        orderqueryVo.setPayMoney(total);
                        orderqueryVo.setParkingCktime(order.getParkingCktime());
                    }
                }
            }
            }
            else if (order1 != null &&order1.getPayStatus().equals("0") && order1.getCarnumber().equals(order.getCarnumber())) {
                //不是第一次进入
                //code = orderDao.insert(order);
                    SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    order1.setParkingTimesjc(sf.parse(order1.getParkingTime()).getTime());
                    BeanUtils.copyProperties(order1, orderqueryVo);
                    userVo = userDao.queryById(order.getUserid());
                    orderqueryVo.setVipstatus(Integer.parseInt(userVo.getVipstatus().toString()));

            }

            else if (order1 != null && order.getPayStatus().equals("1") && order1.getCarnumber().equals(order.getCarnumber())) {
                order.setOrdernumber(RandomsUtil.buildRandom());
                code = orderDao.insert(order);
                if (code > 0) {
                    orderqueryVo = orderDao.queryBycarnumber(order);
                }
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        return orderqueryVo;
    }*/
    @Override
    public Result insert(Order order) {
        OrderqueryVo orderqueryVo = null;
        OrderqueryVo orderqueryVo1 = null;
        OrderqueryVo orderqueryVo2 = null;
        OrderExtend orderExtend = new OrderExtend();
        int code = 0;
        try {
            orderqueryVo = orderDao.queryBycarnumber(order);
            if (orderqueryVo == null) return Result.success("没有这条记录");

            //不为空  设置出场时间 并计算金额
            //出场处理  订单金额结算
            order.setParkingCktime(DateUtils.getFormatDate(new Date()));//车辆出场时间

            code = orderDao.update(order);
            String firsttime = orderqueryVo.getParkingTime();
            if (code > 0) {
                orderqueryVo1 = orderDao.queryBycarnumber(order);
                String endtime = orderqueryVo1.getParkingCktime();
                int hours = DateUtils.sjc(firsttime, endtime);
                GaragequeryVo garagequeryVo = garageService.queryBygaragecode(order.getGarageid());//查询停车场收费标准
                if (hours < 60) {
                    order.setPayMoney(garagequeryVo.getBanhour());
                    orderDao.update(order);
                    orderqueryVo.setPayMoney(garagequeryVo.getBanhour());
                    orderqueryVo.setParkingCktime(order.getParkingCktime());
                } else if (hours > 60) {
                    BigDecimal money = garagequeryVo.getOnehour();
                    BigDecimal hour = BigDecimal.valueOf(hours);
                    BigDecimal total = money.multiply(hour);

                    order.setPayMoney(total);
                    orderDao.update(order);
                    orderqueryVo.setPayMoney(total);
                    orderqueryVo.setParkingCktime(order.getParkingCktime());
                }
            }

        } catch (Exception e) {
            e.printStackTrace();
        }


        return Result.success(orderqueryVo);
    }

    /**
     * 修改数据
     *
     * @param order 实例对象
     * @return 实例对象
     */
    @Override
    public Order update(Order order) {
        this.orderDao.update(order);
        return this.queryById(order.getId());
    }

    @Override
    public int updateOrder(Order order) {
        return orderDao.updateOrder(order);
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.orderDao.deleteById(id) > 0;
    }

 /*   @Override
    public List<OrderqueryVo> countgaraagemoney(OrderqueryParm orderqueryParm) {
        Order o = new Order();
        List<OrderqueryVo> list = null;
        List<OrderqueryVo> list1 = null;

        String[][] strings = new String[][]{
                {"01", "02"},
                {"03", "04"},
                {"05", "06"},
                {"07", "08"},
                {"09", "10"},
                {"10", "12"},
                {"12", "14"},
                {"14", "16"},
                {"17", "18"},
                {"19", "20"},
                {"21", "22"},
                {"23", "00"},};
        try {
            BeanUtils.copyProperties(orderqueryParm, o);
            list = orderDao.countgaraagemoney(o);
            if (list.size() > 0) {
                for (int i = 0; i < strings.length; i++) {
                    OrderqueryVo orderqueryVo = new OrderqueryVo();
                    double money = 0;
                    String[] a = strings[i];
                    for (int j = 0; j < a.length; j++) {
                        money += list.stream().filter(s -> s.getHour().equals(a)).collect(Collectors.toList())
                                .stream().mapToDouble(OrderqueryVo::getPayMoney).sum();

                    }
                    orderqueryVo.setPayMoney(new BigDecimal(money));
                    orderqueryVo.setHour(a[i]);
                    list1.add(orderqueryVo);
                }
                return list1;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return Collections.emptyList();
    }*/

    @Override
    public List<OrderqueryVo> garageweekmoney(OrderqueryParm orderqueryParm) {
        Order o = new Order();
        List<OrderqueryVo> orderqueryVo = null;
        try {
            BeanUtils.copyProperties(orderqueryParm, o);
            orderqueryVo = orderDao.garageweekmoney(o);
            if (orderqueryVo.size() > 0)
                return orderqueryVo;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Collections.emptyList();
    }

    @Override
    public OrderqueryVo garagemonthmoney(OrderqueryParm orderqueryParm) {

        Order o = new Order();
        OrderqueryVo orderqueryVo = null;
        try {
            BeanUtils.copyProperties(orderqueryParm, o);
            orderqueryVo = orderDao.garagemonthmoney(o);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return orderqueryVo;
    }

    @Override
    public OrderqueryVo garagemoney(OrderqueryParm orderqueryParm) {
        Order o = new Order();
        OrderqueryVo orderqueryVo = null;
        try {
            BeanUtils.copyProperties(orderqueryParm, o);
            orderqueryVo = orderDao.garagemoney(o);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return orderqueryVo;
    }

    @Override
    public OrderqueryVo countcar(OrderqueryParm orderqueryParm) {

        Order o = new Order();
        OrderqueryVo orderqueryVo = null;
        try {
            BeanUtils.copyProperties(orderqueryParm, o);
            orderqueryVo = orderDao.countcar(o);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return orderqueryVo;
    }

    @Override
    public List<GarageOrderVo> countgaragecars() {
        List<GarageOrderVo> list = null;
        try {
            list = orderDao.countgaragecars();
            if (list.size() > 0) {
                return list;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Collections.emptyList();
    }

    @Override
    public List<OrderqueryVo> allgarageweekmoney() {
        List<OrderqueryVo> list = null;
        try {
            list = orderDao.allgarageweekmoney();
        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }

    @Override
    public List<OrderqueryVo> garagemonth(OrderqueryParm orderqueryParm) {
        Order order = new Order();
        List<OrderqueryVo> list = null;
        try {
            BeanUtils.copyProperties(orderqueryParm, order);
            list = orderDao.garagemonth(order);
            if (list.size() > 0)
                return list;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Collections.emptyList();
    }


    /**
     * 0.根据接口查询不太的时间范围
     * 1.获取24小时生成默认map
     * 2.根据24小时查询数据
     * 3.对数据进行组装
     *
     * @return
     */
    public Object garagemonth(DateTypeEnum dateTypeEnum) {
//        if (dateTypeEnum == null) throw new RuntimeException("请传入时间类型!");
//        LocalDate begin = null;
//        LocalDate end = null;
//
//        HashMap<String, BigDecimal> map = new HashMap();
//        for (String hours : DatesUtil.hours) {
//            map.put(hours, BigDecimal.ZERO);
//        }
//
//        LocalDate today = LocalDate.now();
//        switch (dateTypeEnum) {
//            case YESTERDAY:
//                begin = LocalDate.now().plusDays(-1);
//                end = begin;
//                break;
//            case LASTWEEK:
//                begin = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
//                end = today.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY));
//                break;
//            case LASTMONTH:
//                begin = LocalDate.of(today.getYear(), today.getMonthValue() - 1, 1);
//                end = begin.with(TemporalAdjusters.lastDayOfMonth());
//                break;
//            default:
//                throw new RuntimeException("暂不支持此类型!");
//        }
//
//
//        List<SelectIncomeByTimeVo> vos = orderDao.selectIncomeByTime(begin, end);
//        for (SelectIncomeByTimeVo vo : vos) {
//            map.put(vo.getHours(), vo.getAmount());
//        }
//
//        List<String> nameList = new ArrayList<>(25);
//        List<BigDecimal> valueList = new ArrayList<>(25);
//
//        for(Map.Entry<String, BigDecimal> entry : map.entrySet()){
//            nameList.add(entry.getKey());
//            valueList.add(entry.getValue());
//        }
//        return new IncomeStatisticsVo(nameList,valueList);
        return null;
    }





    @Override
    public OrderqueryVo inserts(Order order) {
        int code = 0;
        OrderqueryVo orderqueryVo = null;
        try {
            order.setOrdernumber(RandomsUtil.buildRandom());
            order.setType(0);
            code = orderDao.inserts(order);
            if (code > 0) {
                orderqueryVo = orderDao.queryBycarnumber(order);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return orderqueryVo;
    }

    @Override
    public OrderqueryVo queryOrder(Order order) {
        OrderqueryVo orderqueryVo = null;
        try {
            orderqueryVo = orderDao.queryOrder(order);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return orderqueryVo;
    }


    @Override
    public OrderqueryVo queryByordernum(String ordernumber) {
        OrderqueryVo orderqueryVo = null;
        try {
            orderqueryVo = orderDao.queryByordernum(ordernumber);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return orderqueryVo;
    }

    @Override
    public OrderqueryVo getMaxParkingTimeByUserid(String garageid, String userid, String carnumber) {
        return orderDao.getMaxParkingTimeByUserid(garageid, userid, carnumber);
    }

    @Override
    public Result getordetdetil(Order order) {
        OrderExtend orderExtend = new OrderExtend();//订单业务扩展
        OrderqueryVo orderqueryVo = orderDao.queryBycarnumber(order);
        GaragequeryVo garagequeryVo = garageService.queryBygaragecode(order.getGarageid());//查询停车场收费标准
        //查询停车场月票价格
        GarageMonthConfig garageMonthConfig = garageMonthConfigService.queryAll(order.getGarageid());
        //查询该用户是不是会员
        MonthbilRecordVo monthbilRecordVo = monthbilRecordDao.getcarisvip(order.getUserid(), order.getCarnumber(), order.getGarageid());
        //有牌车查询  有牌车入场是摄像头识别的 出场的时候需要做绑定车牌 添加用户 添加用户车
        OrderqueryVo youpaiche = orderDao.queryBycarnumbers(order.getGarageid(), order.getCarnumber());
        UserCar userCar = new UserCar();
        User user = new User();
        if (youpaiche != null) {
            if (order.getCarnumber().equals(youpaiche.getCarnumber()) && youpaiche.getType() == 1) {


                orderDao.uspateBycarnumber(order.getGarageid(), order.getCarnumber(), order.getUserid());
                UserVo userVo = userDao.queryuserexistence(order.getUserid());//查询用户是否存在
                if (userVo != null) {   //用户存在只是添加新的车 一个人对应多辆车
                    BeanUtils.copyProperties(order, userCar);
                    userCar.setCartype("1");
                    userCar.setGarageCode(order.getGarageid());
                    userCarDao.insert(userCar);
                } else {
                    //用户不存在  新增
                    user.setUserid(order.getUserid());
                    userCar.setGarageCode(order.getGarageid());
                    userCar.setUserid(order.getUserid());
                    userCar.setCarnumber(order.getCarnumber());
                    userCar.setCartype("1");
                    userDao.insert(user);
                    userCarDao.insert(userCar);
                }
                orderqueryVo.setBanhour(garagequeryVo.getBanhour());
                orderqueryVo.setOnehour(garagequeryVo.getBanhour());
                if (monthbilRecordVo != null) {//判断该用户是不是会员
                    if (monthbilRecordVo.getPayStatus().equals("11")) {
                        orderqueryVo.setVipstatus(1);
                    }
                } else
                    orderqueryVo.setVipstatus(0);

                return Result.success(orderExtend.drdersettlement(youpaiche, order, garagequeryVo, garageMonthConfig));
            }
        }


        if (orderqueryVo == null) return Result.failure("订单为空，没有此条订单记录");
     /*   String firsttime="";
        try {
                firsttime=orderqueryVo.getParkingTime();

            String endtime=DateUtils.getFormatDate(new Date());
            int hours=  DateUtils.sjc(firsttime, endtime);
            if(hours<60){
                order.setPayMoney(garagequeryVo.getBanhour());
                orderqueryVo.setPayMoney(order.getPayMoney());
            }else{
                BigDecimal money = garagequeryVo.getOnehour();
                BigDecimal hour = BigDecimal.valueOf(hours);
                BigDecimal total = money.multiply(hour);
                order.setPayMoney(total);
                orderqueryVo.setPayMoney(total);
            }
                    orderqueryVo.setParkingTimesjc(DateUtils.getParse(orderqueryVo.getParkingTime()).getTime());
                    orderqueryVo.setMonthvipmoney(garageMonthConfig.getMonthvipmoney());

        } catch (ParseException e) {
            e.printStackTrace();
        }*/
        orderqueryVo.setBanhour(garagequeryVo.getBanhour());
        orderqueryVo.setOnehour(garagequeryVo.getBanhour());
        if (monthbilRecordVo != null) {//判断该用户是不是会员
            if (monthbilRecordVo.getPayStatus().equals("11")) {
                orderqueryVo.setVipstatus(1);
            }
        } else
            orderqueryVo.setVipstatus(0);
        return Result.success(orderExtend.drdersettlement(orderqueryVo, order, garagequeryVo, garageMonthConfig));
    }

    @Override
    public OrderqueryVo queryBycarnumber(Order order) {
        return orderDao.queryBycarnumber(order);
    }

    @Override
    public BigDecimal jisuanmoney(String firsttime, String endtime) {
        return null;
    }

    @Override
    public Result getyufukuanorder(String garageid, String userid) {
        List<OrderqueryVo> orderqueryVo = null;
        try {
            orderqueryVo = orderDao.getyufukuanorder(garageid, userid);
            if (orderqueryVo == null) Result.failure("该用户还没有订单记录");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Result.success(orderqueryVo);
    }

    @Override
    public OrderqueryVo getyufukuanorders(String garageid, String userid, String carnumber) {
        return orderDao.getyufukuanorders(garageid, userid, carnumber);
    }

    @Override
    public Result countgaraagemoney(OrderqueryParm orderqueryParm) {
        Order order = new Order();
        List<OrderqueryVo> list = null;
        try {
            BeanUtils.copyProperties(orderqueryParm, order);
            list = orderDao.countgaraagemoney(order);
            if (list == null) {
                return Result.success(Collections.emptyList());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Result.success(list);
    }

    @Override
    public Result wxgopay(OrderPayParm orderPayParm) {
        //查询订单
        Order order = new Order();
        OrderqueryVo orderqueryVo = null;
        order.setCarnumber(orderPayParm.getCarnumber());
        order.setGarageid(orderPayParm.getGarageid());
        order.setUserid(orderPayParm.getUserid());
        orderqueryVo = orderDao.queryOrder(order);
        //通过获取当前时间  去计算金额   这个当前时间没有存入数据库
        orderqueryVo.setParkingCktime(DateUtils.getFormatDate(new Date()));

        if (orderqueryVo == null) return Result.failure("没有此订单记录");

        GaragequeryVo garagequeryVo = garageService.queryBygaragecode(order.getGarageid());//查询停车场收费标准

        //获取订单的入场时间
        String firsttime = orderqueryVo.getParkingTime();
        String endtime = orderqueryVo.getParkingCktime();
        try {
            int hours = DateUtils.sjc(firsttime, endtime);
   /*         if(orderPayParm.getEwmzt().equals("2")){

                order.setParkingTime(DateUtils.getFormatDate(new Date(new Date().getTime()+15*60*1000)));
                //order.setParkingCktime(DateUtils.getFormatDate(new Date()));
                orderDao.update(order);//修改入场时间
               OrderqueryVo orderqueryVo1=orderDao.queryOrder(order);
                orderqueryVo1.setPayMoney(new BigDecimal("0.01"));
                orderqueryVo1.setEwmzt("2");
                return Result.success(orderqueryVo1);

            }else {*/

            if (hours < 60) {
                order.setPayMoney(garagequeryVo.getBanhour());
                orderDao.update(order);
                orderqueryVo.setPayMoney(garagequeryVo.getBanhour());
                //orderqueryVo.setParkingCktime(order.getParkingCktime());
            } else if (hours > 60) {
                BigDecimal money = garagequeryVo.getOnehour();
                BigDecimal hour = BigDecimal.valueOf(hours);
                BigDecimal total = money.multiply(hour);
                order.setPayMoney(total);
                orderDao.update(order);
                orderqueryVo.setPayMoney(total);
                //orderqueryVo.setParkingCktime(order.getParkingCktime());
            }
            //   }

        } catch (Exception e) {
            e.printStackTrace();
        }
        return Result.success(orderqueryVo);
    }


}